import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../main.dart';
class LoseNetworkDialog{

  openDialog(){
    Future.delayed(const Duration(seconds: 1),(){
      _open();
    });
  }

  _open(){
    if(Get.isDialogOpen != null && Get.isDialogOpen!){
      Get.back();
    }
    tts.speak('请检查网络');
    Get.defaultDialog(
      title: "",
      barrierDismissible: false,
      contentPadding:EdgeInsets.zero,
      titlePadding:EdgeInsets.zero,
      backgroundColor: Colors.transparent,
      content: Container(
        width: 200.w,
        height: 178.h,
        padding: EdgeInsets.only(top:12.r,right: 14.r),
        alignment: AlignmentDirectional.topEnd,
        decoration: const BoxDecoration(
            image: DecorationImage(
              fit: BoxFit.fill,
              image: AssetImage(
                "assets/images/lose_network.png",
              ),
            )
        ),
        child: InkWell(
          onTap: (){
            Get.back();
          },
          child: Image.asset("assets/images/close.png",width: 10.w,fit: BoxFit.fitWidth,),
        )
      ),
    );
  }
}